package modifier.character;

import character.MyCharacter;
import game.CombatController;

public class CharacterModifierPoison extends CharacterModifier {
    protected int damagePerTurn;
    
    @Deprecated
    protected CharacterModifierPoison() {}
    
    public CharacterModifierPoison(MyCharacter owner, int damagePerTurn, int duration) {
        super(owner, duration);
        this.damagePerTurn = damagePerTurn;
    }

    @Override
    protected void apply() {
        System.out.println("Poison applied to "+affectedCharacter+"...");
    }

    @Override
    protected void tick() {
	System.out.println("Poison hits "+affectedCharacter+" for "+damagePerTurn+" damage.");
        CombatController.dealDamage(owner, affectedCharacter, damagePerTurn);
    }

    @Override
    protected void completeNaturally() {
	System.out.println(affectedCharacter+"'s poison has worn off.");
    }

    @Override
    protected void abort() {
        System.out.println(affectedCharacter+"'s poison has been removed.");
    }

    @Override
    public CharacterModifier cloneForCharacter(MyCharacter character) {
        CharacterModifierPoison clone = new CharacterModifierPoison(owner, damagePerTurn, totalTicks);
        cloneMeForCharacter(clone, character);
        clone.damagePerTurn = damagePerTurn;
        return clone;
    }
}
